package de.tudarmstadt.ukp.wikisniffer.userstudy.util;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class QuestionGroup {
	
	private List<Question> questions;

	private String topic;
	
	private Question currentQuestion;

	
	public QuestionGroup(String topic){
		this.topic = topic;
		questions =  new ArrayList<Question>();
	}
	
	public List<Question> getQuestions() {
		return questions;
	}

	public String getTopic() {
		return topic;
	}
	
	public void add(Question question){
		this.questions.add(question);
	}
	
	public Question getNewQuestion(){
		
		if(questions.size() == 0){
			System.err.println("No questions left!");
			currentQuestion = null;
			return currentQuestion;
		}
		
		Random random = new Random();
		
		int randomInt = random.nextInt(questions.size());
		currentQuestion = questions.get(randomInt);
		questions.remove(randomInt);
		
		return currentQuestion;
	}

	public boolean hasQuestion() {
		if(questions.size() == 0){
			return false;
		}
		return true;
	}


	
	

}
